<!DOCTYPE html>
<html onclick="enterLogServer()">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>日志管理系统</title>
  <!-- Tell the browser to be responsive to screen width -->
  <!--<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">-->

  <!--<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>-->
  <style>
    @media (max-width: 750px) {
      html {
        height: 100% !important;
        width: 1920px;
        overflow-x: auto !important;
      }

      body.login-page {
        overflow-x: -moz-scrollbars-none;
      }
    }

    html {
      height: 100% !important;
    }

    body.login-page {
      background: #18c8f6;
      background-repeat: repeat-y;
      width: 100%;
      /*height: 100% !important;*/
      background: url("statics/img/backg02.gif") no-repeat center fixed;
      -webkit-background-size: cover;
      -moz-background-size: cover;
      -o-background-size: cover;
      background-size: cover;
      position: relative;
      color: rgba(255, 255, 255, .95);
      overflow-x: hidden !important;
    }

    .logTitle {
      position: fixed;
      top: 30%;
      right: 45%;
      bottom: calc(50% - 70px);
    }
  </style>
</head>
<body class="hold-transition login-page">
<h1 style="color: #1E9FFF;font-size: 3em" class="logTitle">日志服务</h1>
<!-- /.login-box -->
<script src="${request.contextPath}/statics/libs/jquery.min.js"></script>
<script src="${request.contextPath}/statics/libs/vue.min.js"></script>
<script src="${request.contextPath}/statics/libs/bootstrap.min.js"></script>
<script src="${request.contextPath}/statics/libs/jquery.slimscroll.min.js"></script>
<script src="${request.contextPath}/statics/libs/fastclick.min.js"></script>
<script src="${request.contextPath}/statics/libs/app.js"></script>
<script type="text/javascript">

  /*jquery的加载事件*/
  $(function () {
    /*屏蔽点击右击按钮事件*/
    document.oncontextmenu = function () {
      return false;
    };

    /*document.onkeydown = function () {
      // console.log(window.event.keyCode)
      if (window.event && window.event.keyCode == 13) {
        vm.login()
      }
      if (window.event && window.event.keyCode == 122) {
        event.keyCode = 0;
        event.returnValue = false;
        return false;
      }
    };*/
  });

  /*进入服务时间*/
  function enterLogServer() {
    document.location.href = "content.html";
  }

  var vm = new Vue({
    el: '#rrapp',
    data: {
      system: '转发后台管理系统',
      username: '',
      password: '',
      captcha: '',
      error: false,
      errorMsg: '',
      src: 'captcha.jpg'
    },
    beforeCreate: function () {
      if (self != top) {
        top.location.href = self.location.href;
      }
    },
    methods: {
      refreshCode: function () {
        this.src = "captcha.jpg?t=" + $.now();
      },
      login: function (event) {
        var data = "username=" + vm.username + "&password=" + vm.password + "&captcha=" + vm.captcha;
        $.ajax({
          type: "POST",
          url: "sys/login",
          data: data,
          dataType: "json",
          success: function (result) {
            if (result.code == 0) {//登录成功
              $.ajax({
                type: "POST",
                url: "sys/user/findUserPerms",
                dataType: "json",
                success: function (result) {
                  if (result.code == 0) {//登录成功
                    //return false;
                    localStorage.setItem("permission", JSON.stringify(result.perms))
                    parent.location.href = 'index.html';
                  } else {
                    vm.error = true;
                    vm.errorMsg = result.msg;
                    vm.refreshCode();
                  }
                }
              });
            } else {
              vm.error = true;
              vm.errorMsg = result.msg;
              vm.refreshCode();
            }
          }
        });
      }
    }
  });
</script>
</body>
</html>
